/*
 * Licensed to the anubis
 *
 * Copyright (c) 2023 .
 * All rights reserved.
 * 项目名称：anubis-demo-web
 * 项目描述：基于spring5的spring-mvc新特性
 * 版权说明：本软件属XXX有限公司所有，在未获得XXX有限公司正式授权情况下，任何企业和个人，不能获取、阅读、安装、传播本软件涉及的任何受知识产权保护的内容。
 */
package com.anubis.demo.web.controller;

import com.anubis.demo.service.StockPriceService;
import com.anubis.demo.service.SubscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import static com.anubis.demo.constant.Constants.TEST_USER_EMAIL;

@Controller
public class WebController {

    @Autowired
    private SubscriptionService subscriptionServiceImpl;

    @Autowired
    private StockPriceService stockPriceService;

    /**
     * ...
     */
    @RequestMapping("/")
    public String index(Model model) {
        model.addAttribute("email", TEST_USER_EMAIL);
        model.addAttribute("stockPrices", stockPriceService.getPrice(TEST_USER_EMAIL));
        return "index";
    }

    /**
     * ...
     */
    @RequestMapping("/login")
    public String login() {
        return "login";
    }

}
